package com.hey.lib.depth;

import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * @author Hey
 * created at 2018/4/13 13:37
 */
public abstract class BaseAdapter<T> extends BaseQuickAdapter<T, BaseViewHolder> {

    public BaseAdapter(int layoutResId, @Nullable List<T> data, RecyclerView recyclerView) {
        super(layoutResId, data);
        if (recyclerView != null) {
            this.bindToRecyclerView(recyclerView);
        }
    }

    public BaseAdapter(int layoutResId, @Nullable List<T> data, RecyclerView recyclerView, boolean addEmptyView) {
        super(layoutResId, data);
        this.bindToRecyclerView(recyclerView);
    }

    @Override
    protected void convert(BaseViewHolder helper, T item) {
        bind(helper, item);
    }

    public abstract void bind(BaseViewHolder holder, T item);


}
